//
//  DetailCollectionViewCell.m
//  CwinCar
//
//  Created by dlios on 15/10/21.
//  Copyright © 2015年 dlios. All rights reserved.
//

#import "DetailCollectionViewCell.h"

@implementation DetailCollectionViewCell
-(instancetype)initWithFrame:(CGRect)frame
{
    if ([super initWithFrame:frame]) {
        self.photoV = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, mainScreen_Width*2./5., 80)];
        [self.contentView addSubview:self.photoV];
        self.nameLabel = [[UILabel alloc]initWithFrame:CGRectZero];
        self.nameLabel.font = [UIFont systemFontOfSize:16.];
        self.nameLabel.numberOfLines = 0;
        [self.contentView addSubview:self.nameLabel];
        self.kindLabel = [[UILabel alloc]initWithFrame:CGRectZero];
        self.kindLabel.font = [UIFont systemFontOfSize:14.];
        self.kindLabel.numberOfLines = 0;
        self.kindLabel.textColor = [UIColor colorWithWhite:0.530 alpha:1.000];
        [self.contentView addSubview:self.kindLabel];
        self.rangeLabel = [[UILabel alloc]initWithFrame:CGRectZero];
        self.rangeLabel.font = [UIFont systemFontOfSize:14];
        self.rangeLabel.numberOfLines = 0;
        [self.contentView addSubview:self.rangeLabel];
    }
    return self;
}
-(void)setRadioModel:(RadioModel *)model
{
    self.photoV.frame = CGRectMake(0, 0, mainScreen_Width*2./7., mainScreen_Width*2./7.);
    self.photoV.layer.masksToBounds = YES;
    self.photoV.layer.cornerRadius = mainScreen_Width*1./7. * suitableScreen_Height;
    [self.photoV sd_setImageWithURL:[NSURL URLWithString:model.album_imgurl]placeholderImage:[UIImage imageNamed:@"zhanweitu"]];
    
    if (model.type == 1) {
        self.isType = YES;
        self.rangeLabel.frame = CGRectMake(mainScreen_Width*1/7, 0, mainScreen_Width/8, 15 * suitableScreen_Height);
        self.rangeLabel.layer.masksToBounds = YES;
        self.rangeLabel.layer.cornerRadius = 8 * suitableScreen_Width;
        self.rangeLabel.text = @"原创";
        self.rangeLabel.textColor = [UIColor whiteColor];
        self.rangeLabel.font = [UIFont systemFontOfSize:12.];
        self.rangeLabel.backgroundColor = [UIColor colorWithRed:0.054 green:0.200 blue:1.000 alpha:1.000];
        self.rangeLabel.textAlignment = NSTextAlignmentCenter;
    }else
    {
        self.isType = NO;
        
    }
    self.nameLabel.frame = CGRectMake(0, mainScreen_Width*2./7.+10, mainScreen_Width*2./7., 20 * suitableScreen_Height);
    self.nameLabel.text = model.album_name;
    self.nameLabel.textAlignment = NSTextAlignmentCenter;
    
    self.kindLabel.text = model.update_time;
    self.kindLabel.frame = CGRectMake(0, mainScreen_Width*2./7.+self.nameLabel.frame.size.height+20, mainScreen_Width*2./7., 15 * suitableScreen_Height);
    self.kindLabel.textAlignment = NSTextAlignmentCenter;
    
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
